<%@ page language="java" import="java.util.*" pageEncoding="utf-8"%>
<%@ page import="org.lsms.dao.impl.*" %>
<%@ page import="org.lsms.bean.*" %>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  <head>
    
    <title>Member Decision Details Page</title>
    
	<meta http-equiv="pragma" content="no-cache">
	<meta http-equiv="cache-control" content="no-cache">
	<meta http-equiv="expires" content="0">    
	<meta http-equiv="keywords" content="LSMS,ICSEE,MEMBER">
	
	<link rel="stylesheet" type="text/css" href="../css/author_layout.css">
	<link rel="stylesheet" type="text/css" href="../css/hyper_link_style.css">

	<style type="text/css">
	
		th{
			width:100px;
		}
		td{
			text-align:center;
		}
	
	</style>

  </head>
  
  <body>
	<div id="container">
		<div id="header" class="logo_image"></div>
		<div class="nav"></div>
		<div id="author_menu" class="border">
			<table border="0" width="100%"  >
				<tr>
					<td  bgcolor="#CCCCCC"><a href="../index.jsp">impaHome</a></td>
				</tr>
				<tr>
					<td  bgcolor="#CCCCCC"><a href="select_topic.jsp">Select Topics</a></td>
				</tr>
				<tr>
				<%
					DaoImpl impl = new DaoImpl();
					HashMap<String,Integer> hm = impl.get_site_setting();
					int reviewer_invite = hm.get("reviewer_invite");
					if(reviewer_invite==1){
				 %>
					<td  bgcolor="#CCCCCC"><a href="invite_reviewer.jsp">Invite Reviewer</a></td>
				<%
					}else{
				 %>
				 	<td  bgcolor="#CCCCCC"><a href="../error/invite_reviewer_forbidden.jsp">Invite Reviewer</a></td>	
				<%
					}
				 %>	
				</tr>
				<tr>
					<td  bgcolor="#CCCCCC"><a href="reviewer_conf.jsp">Reviewer Confirmation</a></td>
				</tr>
				<tr>
					<td  bgcolor="#CCCCCC"><a href="paper_assign.jsp">Paper Status/Paper Assign</a></td>
				</tr>
				<tr>
					<td  bgcolor="#CCCCCC"><a href="member_decision.jsp">Decision</a></td>
				</tr>
				<tr>
					<td  bgcolor="#CCCCCC"><a href="modify_info.jsp">Modify Information</a></td>
				</tr>
				<tr>
					<td  bgcolor="#CCCCCC"><a href="../logout">Log Out</a></td>
				</tr>
			</table>
		</div>
		
		<div id="content" class="bg_color border">
			<p><b>Paper Check Up</b></p>
			<div style="margin:15px">
				<div id="paper_info">
				<p align="left">Paper Information</p> 
				<table align="center" border="0" style="width:650px">
				<%
					int paper_id = Integer.parseInt(request.getParameter("paper_id"));
					Paper paper = new Paper();
					paper = impl.get_paper_info(paper_id);
				 %>
				<tr>
					<th>Paper ID</th>
					<td style="text-align:left">
					<%
						out.print(paper_id);
					 %>
					</td>
				</tr>
				<tr>
					<th>Title</th>
					<td style="text-align:left">
					<%
						out.print(paper.getPapertitle());
					 %>
					</td>
				</tr>
				<tr>
					<th>Abstract</th>
					<td style="text-align:left">
					<%
						out.print(paper.getPaperabstract());
					 %>
					</td>
				</tr>
				<tr>
					<th>Key Words</th>
					<td style="text-align:left">
					<%
						out.print(paper.getPaperkeywords());
					 %>
					</td>
				</tr>
				<tr>
					<th>Topic 1</th>
					<td style="text-align:left">
					<%
						String topic1_name = paper.getFirsttopic();
						String topic1_content = impl.get_topic_content(topic1_name);
						out.print(topic1_content);
					 %>
					</td>
				</tr>
				<tr>
					<th>Topic 2</th>
					<td style="text-align:left">
					<%
						String topic2_name = paper.getSecondtopic();
						String topic2_content = impl.get_topic_content(topic2_name);
						out.print(topic2_content);
					 %>
					</td>
				</tr>
				<tr>
					<th>Author(s)</th>
					<td style="text-align:left">
					<%
						out.print(paper.getAuthorname());
					 %>
					</td>
				</tr>
				<tr>
					<td colspan="2" style="text-align:center">
					<%
						String savename = "..";
						savename += paper.getSavename();
					 %>
					 <a href="<%=savename %>">DownLoad</a>
					</td>
				</tr>
				</table>
				</div>
				
				<p align="left">Grades From Reviewers</p>
				<div id="grade_info" class="border">
					<table align="center" border="0" style="width:680px">
					<tr>
						<th>Paper ID</th>
						<th>Reviewer ID</th>
						<th>A</th>
						<th>B</th>
						<th>C</th>
						<th>D</th>
						<th>E</th>
						<th>AVE</th>
						<th>Reviewer's expertise</th>
						<th>Recommend</th>
						<th>Note</th>
					</tr>
					<%
						int member_id = Integer.parseInt(session.getAttribute("userid").toString());
						HashMap<String,List<Paper_Grade>> map = impl.get_paper_grade(paper_id);
						List<Paper_Grade> list = map.get("all");
						Iterator it = list.iterator();
						if(list.size()<1){
					%>
					<tr>
						<td colspan="11">
						<p>No Information!</p>
						</td>
					</tr>
					<%
						}
						for(int i=0;i<list.size();i++){
							Paper_Grade paper_grade = list.get(i);
					 %>
					 <tr>
					 	<td>
					 	<%
					 		out.print(paper_id);
					 	 %>
					 	</td>
					 	<td>
					 	<%
					 		int reviewer_id = paper_grade.getReviewer_id();
					 		out.print(reviewer_id);
					 	 %>
					 	</td>
					 	<td>
					 	<%
					 		int a = paper_grade.getProblem_a();
					 		out.print(a);
					 	 %>
					 	</td>
					 	<td>
					 	<%
					 		int b = paper_grade.getProblem_b();
					 		out.print(b);
					 	 %>
					 	</td>
					 	<td>
					 	<%
					 		int c = paper_grade.getProblem_c();
					 		out.print(c);
					 	 %>
					 	</td>
					 	<td>
					 	<%
					 		int d = paper_grade.getProblem_d();
					 		out.print(d);
					 	 %>
					 	</td>
					 	<td>
					 	<%
					 		int e = paper_grade.getProblem_e();
					 		out.print(e);
					 	 %>
					 	</td>
					 	<td>
					 	<%
					 		double ave = (a+b+c+d+e)/5;
					 		out.print(ave);
					 	 %>
					 	</td>
					 	<td>
					 	<%
					 		out.print(paper_grade.getExpertise());
					 	 %>
					 	</td>
					 	<td>
					 	<%
					 		int recommend = paper_grade.getRecommend();
					 		if(recommend==1){
					 	 %>
					 	 <font color="green">YES</font>
					 	 <%
					 	 }else{
					 	  %>
					 	  <font color="red">NO</font>
					 	  <%
					 	  	}
					 	   %>
					 	</td>
					 	<td>
					 	<a href="view_note.jsp?paper_id=<%=paper_id%>&reviewer_id=<%=reviewer_id%>">Note</a>
					 	</td>
					 </tr>
					 <%
					 	}
					  %>
					</table>
				
				</div>
				
				<p align="left">Your Decision</p>
				<div>
				<form action="../member_paper_decision?paper_id=<%=paper_id%>&member_id=<%=member_id%>" method="post">
			 	<table align="left">
			 	<tr>
			 		<td>
			 			Note to Chair
			 		</td>
			 		<td>
			 			<textarea cols="25" rows="5" name="note_to_chair" ></textarea>
			 		</td>
			 	</tr>
			 	<tr>
			 		<td>
			 			Recommend
			 		</td>
			 		<td>
			 			<input type="radio" name="recommend" value="1">Yes&nbsp;
			 			&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
			 			<input type="radio" name="recommend" value="0">No&nbsp;
			 		</td>
			 	</tr>
			 	<tr>
			 		<td colspan="2">
			 		<font color="red">&nbsp;&nbsp;*Note: Once you submit the form, you can not edit it again. </font>
			 		</td>
			 	</tr>
			 	<tr>
			 		<td>
			 		<br>
			 		</td>
			 	</tr>
			 	<tr>
			 		<td colspan="2" style="text-align:center">
			 		<input type="submit" value="Submit" onclick="return window.confirm('Are You Sure?')">
			 		</td>
			 	</tr>
			 	</table>	
			 	</form>
				</div>
			</div>
			
		</div>
		
		<div class="nav"></div>
			
		<div id="footer" class="footer_color border">
			<p align="center"><b>&copy;2010 LSMS-All Rights Reserved.</b></p>
			<p align="center"> <b>Powered by Shu.</b></p>
		</div>
	</div>
  </body>
</html>
